 Imports MySql.Data.MySqlClient 
 Imports System.Data.OleDb
Imports System.Data.SqlClient
 Imports System .Data .SqlServerCe 
 Imports System.Data.OracleClient 
Imports System.Data
Imports DTO
Public Class CTDIEMDao
Inherits AbstractDao
 #Region "New" 
 Public Sub New(ByVal connection As KetNoiDto)
 MyBase.New(connection)
 End Sub
 Public Sub New( ByVal IDCTDIEM As System.Int32, ByVal connection As KetNoiDto)
 MyBase.New("CTDIEM", "select * from CTDIEM where IDCTDIEM=" & IDCTDIEM & "", connection)
 End Sub
 #End Region 
 Public Sub Them(ByVal Dto As CTDIEMDto)
 Dim strsql As String
 strsql = "Insert into CTDIEM(IDDIEM,DIEM,LOAIDIEM,TRANGTHAI,GHICHU) values (?,?,?,?,?)
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 Dim cmd As New OleDbCommand(strsql, Ket_noi_access)
cmd.Parameters.Add("@IDDIEM", OleDbType.Integer)
cmd.Parameters.Add("@DIEM", OleDbType.Integer)
cmd.Parameters.Add("@LOAIDIEM", OleDbType.Integer)
cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
cmd.Parameters("@IDDIEM").Value = Dto.IDDIEM
cmd.Parameters("@DIEM").Value = Dto.DIEM
cmd.Parameters("@LOAIDIEM").Value = Dto.LOAIDIEM
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 strsql = "Select @@IDENTITY"
 cmd = New OleDbCommand(strsql, Ket_noi_access)
 Dto.IDCTDIEM = cmd.ExecuteScalar()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress
 strsql = "Insert into CTDIEM(IDDIEM,DIEM,LOAIDIEM,TRANGTHAI,GHICHU) values (@IDDIEM,@DIEM,@LOAIDIEM,@TRANGTHAI,@GHICHU)
 Dim cmd As New sqlCommand(strsql, Ket_noi_sql)
cmd.Parameters.Add("@IDDIEM", SqlDbType.Int)
cmd.Parameters.Add("@DIEM", SqlDbType.Int)
cmd.Parameters.Add("@LOAIDIEM", SqlDbType.Int)
cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
cmd.Parameters("@IDDIEM").Value = Dto.IDDIEM
cmd.Parameters("@DIEM").Value = Dto.DIEM
cmd.Parameters("@LOAIDIEM").Value = Dto.LOAIDIEM
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 strsql = "Select @@IDENTITY"
 cmd = New sqlCommand(strsql, Ket_noi_sql)
 Dto.IDCTDIEM = cmd.ExecuteScalar()
 Case Class_KieuDL.SqlCe
 strsql = "Insert into CTDIEM(IDDIEM,DIEM,LOAIDIEM,TRANGTHAI,GHICHU) values (@IDDIEM,@DIEM,@LOAIDIEM,@TRANGTHAI,@GHICHU)
 Dim cmd As New sqlceCommand(strsql, Ket_noi_SqlCe)
cmd.Parameters("@IDDIEM").Value = Dto.IDDIEM
cmd.Parameters("@DIEM").Value = Dto.DIEM
cmd.Parameters("@LOAIDIEM").Value = Dto.LOAIDIEM
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strsql = "Insert into CTDIEM(IDDIEM,DIEM,LOAIDIEM,TRANGTHAI,GHICHU) values (@IDDIEM,@DIEM,@LOAIDIEM,@TRANGTHAI,@GHICHU)
 Dim cmd As New OracleCommand(strsql, Ket_noi_Oracle)
cmd.Parameters("@IDDIEM").Value = Dto.IDDIEM
cmd.Parameters("@DIEM").Value = Dto.DIEM
cmd.Parameters("@LOAIDIEM").Value = Dto.LOAIDIEM
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Mysql
 strsql = "Insert into CTDIEM(IDDIEM,DIEM,LOAIDIEM,TRANGTHAI,GHICHU) values (@IDDIEM,@DIEM,@LOAIDIEM,@TRANGTHAI,@GHICHU)
 Dim cmd As New MySqlCommand(strsql, Ket_noi_MySql)
cmd.Parameters.Add("@IDDIEM", MySqlDbType.Int32)
cmd.Parameters.Add("@DIEM", MySqlDbType.Int32)
cmd.Parameters.Add("@LOAIDIEM", MySqlDbType.Int32)
cmd.Parameters.Add("@TRANGTHAI", MySqlDbType.Int32)
cmd.Parameters.Add("@GHICHU", MySqlDbType.String)
cmd.Parameters("@IDDIEM").Value = Dto.IDDIEM
cmd.Parameters("@DIEM").Value = Dto.DIEM
cmd.Parameters("@LOAIDIEM").Value = Dto.LOAIDIEM
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub Xoa( ByVal IDCTDIEM As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
strSQL = "Delete From CTDIEM Where IDCTDIEM= ? 
Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
cmd.Parameters.Add("@IDCTDIEM",OleDbType.Integer).Value = IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
strSQL = "Delete From CTDIEM Where IDCTDIEM= @IDCTDIEM
Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
cmd.Parameters.Add("@IDCTDIEM",SqlDbType.Int).value=IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
strSQL = "Delete From CTDIEM Where IDCTDIEM=" & IDCTDIEM & "
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
strSQL = "Delete From CTDIEM Where IDCTDIEM=" & IDCTDIEM & "
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
strSQL = "Delete From CTDIEM Where IDCTDIEM=" & IDCTDIEM & "
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub sua(ByVal dto As CTDIEMDto)
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update CTDIEM Set IDDIEM=? ,DIEM=? ,LOAIDIEM=? ,TRANGTHAI=? ,GHICHU= ? where IDCTDIEM= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
cmd.Parameters.Add("@IDDIEM", OleDbType.Integer)
cmd.Parameters.Add("@DIEM", OleDbType.Integer)
cmd.Parameters.Add("@LOAIDIEM", OleDbType.Integer)
cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
cmd.Parameters.Add("@IDCTDIEM", OleDbType.Integer)
cmd.Parameters("@IDDIEM").Value = dto.IDDIEM
cmd.Parameters("@DIEM").Value = dto.DIEM
cmd.Parameters("@LOAIDIEM").Value = dto.LOAIDIEM
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDCTDIEM").Value = dto.IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update CTDIEM Set IDDIEM= @IDDIEM , DIEM= @DIEM , LOAIDIEM= @LOAIDIEM , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDCTDIEM= @IDCTDIEM"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
cmd.Parameters.Add("@IDDIEM", SqlDbType.Int)
cmd.Parameters.Add("@DIEM", SqlDbType.Int)
cmd.Parameters.Add("@LOAIDIEM", SqlDbType.Int)
cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
cmd.Parameters.Add("@IDCTDIEM", SqlDbType.Int)
cmd.Parameters("@IDDIEM").Value = dto.IDDIEM
cmd.Parameters("@DIEM").Value = dto.DIEM
cmd.Parameters("@LOAIDIEM").Value = dto.LOAIDIEM
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDCTDIEM").Value = dto.IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update CTDIEM Set IDDIEM= @IDDIEM , DIEM= @DIEM , LOAIDIEM= @LOAIDIEM , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDCTDIEM= @IDCTDIEM"
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
cmd.Parameters("@IDDIEM").Value = dto.IDDIEM
cmd.Parameters("@DIEM").Value = dto.DIEM
cmd.Parameters("@LOAIDIEM").Value = dto.LOAIDIEM
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDCTDIEM").Value = dto.IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update CTDIEM Set IDDIEM= @IDDIEM , DIEM= @DIEM , LOAIDIEM= @LOAIDIEM , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDCTDIEM= @IDCTDIEM"
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
cmd.Parameters("@IDDIEM").Value = dto.IDDIEM
cmd.Parameters("@DIEM").Value = dto.DIEM
cmd.Parameters("@LOAIDIEM").Value = dto.LOAIDIEM
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDCTDIEM").Value = dto.IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update CTDIEM Set IDDIEM= @IDDIEM , DIEM= @DIEM , LOAIDIEM= @LOAIDIEM , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDCTDIEM= @IDCTDIEM"
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
cmd.Parameters.Add("@IDDIEM", MySqlDbType.Int32)
cmd.Parameters.Add("@DIEM", MySqlDbType.Int32)
cmd.Parameters.Add("@LOAIDIEM", MySqlDbType.Int32)
cmd.Parameters.Add("@TRANGTHAI", MySqlDbType.Int32)
cmd.Parameters.Add("@GHICHU", MySqlDbType.String)
cmd.Parameters.Add("@IDCTDIEM", MySqlDbType.Int32)
cmd.Parameters("@IDDIEM").Value = dto.IDDIEM
cmd.Parameters("@DIEM").Value = dto.DIEM
cmd.Parameters("@LOAIDIEM").Value = dto.LOAIDIEM
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDCTDIEM").Value = dto.IDCTDIEM
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub SuaIDDIEM( ByVal IDDIEM as System.Int32, ByVal IDCTDIEM As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update CTDIEM Set IDDIEM = ?  where IDCTDIEM= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@IDDIEM", OleDbType.Integer)
 cmd.Parameters.Add("@IDCTDIEM", OleDbType.Integer)
 cmd.Parameters("@IDDIEM").Value =  IDDIEM
cmd.Parameters("@IDCTDIEM").Value =  IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update CTDIEM Set IDDIEM = @IDDIEM  where IDCTDIEM= @IDCTDIEM"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@IDDIEM", SqlDbType.Int)
 cmd.Parameters.Add("@IDCTDIEM", SqlDbType.Int)
 cmd.Parameters("@IDDIEM").Value =  IDDIEM
cmd.Parameters("@IDCTDIEM").Value =  IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update CTDIEM Set IDDIEM =" & IDDIEM & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update CTDIEM Set IDDIEM =" & IDDIEM & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update CTDIEM Set IDDIEM =" & IDDIEM & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaDIEM( ByVal DIEM as System.Int32, ByVal IDCTDIEM As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update CTDIEM Set DIEM = ?  where IDCTDIEM= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@DIEM", OleDbType.Integer)
 cmd.Parameters.Add("@IDCTDIEM", OleDbType.Integer)
 cmd.Parameters("@DIEM").Value =  DIEM
cmd.Parameters("@IDCTDIEM").Value =  IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update CTDIEM Set DIEM = @DIEM  where IDCTDIEM= @IDCTDIEM"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@DIEM", SqlDbType.Int)
 cmd.Parameters.Add("@IDCTDIEM", SqlDbType.Int)
 cmd.Parameters("@DIEM").Value =  DIEM
cmd.Parameters("@IDCTDIEM").Value =  IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update CTDIEM Set DIEM =" & DIEM & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update CTDIEM Set DIEM =" & DIEM & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update CTDIEM Set DIEM =" & DIEM & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaLOAIDIEM( ByVal LOAIDIEM as System.Int32, ByVal IDCTDIEM As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update CTDIEM Set LOAIDIEM = ?  where IDCTDIEM= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@LOAIDIEM", OleDbType.Integer)
 cmd.Parameters.Add("@IDCTDIEM", OleDbType.Integer)
 cmd.Parameters("@LOAIDIEM").Value =  LOAIDIEM
cmd.Parameters("@IDCTDIEM").Value =  IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update CTDIEM Set LOAIDIEM = @LOAIDIEM  where IDCTDIEM= @IDCTDIEM"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@LOAIDIEM", SqlDbType.Int)
 cmd.Parameters.Add("@IDCTDIEM", SqlDbType.Int)
 cmd.Parameters("@LOAIDIEM").Value =  LOAIDIEM
cmd.Parameters("@IDCTDIEM").Value =  IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update CTDIEM Set LOAIDIEM =" & LOAIDIEM & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update CTDIEM Set LOAIDIEM =" & LOAIDIEM & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update CTDIEM Set LOAIDIEM =" & LOAIDIEM & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaTRANGTHAI( ByVal TRANGTHAI as System.Int32, ByVal IDCTDIEM As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update CTDIEM Set TRANGTHAI = ?  where IDCTDIEM= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
 cmd.Parameters.Add("@IDCTDIEM", OleDbType.Integer)
 cmd.Parameters("@TRANGTHAI").Value =  TRANGTHAI
cmd.Parameters("@IDCTDIEM").Value =  IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update CTDIEM Set TRANGTHAI = @TRANGTHAI  where IDCTDIEM= @IDCTDIEM"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
 cmd.Parameters.Add("@IDCTDIEM", SqlDbType.Int)
 cmd.Parameters("@TRANGTHAI").Value =  TRANGTHAI
cmd.Parameters("@IDCTDIEM").Value =  IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update CTDIEM Set TRANGTHAI =" & TRANGTHAI & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update CTDIEM Set TRANGTHAI =" & TRANGTHAI & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update CTDIEM Set TRANGTHAI =" & TRANGTHAI & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaGHICHU( ByVal GHICHU as System.String, ByVal IDCTDIEM As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update CTDIEM Set GHICHU = ?  where IDCTDIEM= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDCTDIEM", OleDbType.Integer)
 cmd.Parameters("@GHICHU").Value =  GHICHU
cmd.Parameters("@IDCTDIEM").Value =  IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update CTDIEM Set GHICHU = @GHICHU  where IDCTDIEM= @IDCTDIEM"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDCTDIEM", SqlDbType.Int)
 cmd.Parameters("@GHICHU").Value =  GHICHU
cmd.Parameters("@IDCTDIEM").Value =  IDCTDIEM
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update CTDIEM Set GHICHU =" & GHICHU & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update CTDIEM Set GHICHU =" & GHICHU & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update CTDIEM Set GHICHU =" & GHICHU & "  where IDCTDIEM=" & IDCTDIEM & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub layBang()
 Chuoi_SQL = " Select * from CTDIEM
 Doc_bang()
 End Sub
 Public Sub layBangTheoIDCTDIEM(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "IDCTDIEM=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from CTDIEM" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoIDCTDIEM(ByVal IDCTDIEM As System.Int32 )
 Chuoi_SQL = " Select * from CTDIEM where  IDCTDIEM = " & IDCTDIEM & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoIDCTDIEM(ByVal IDCTDIEM As System.Int32)
 Dim strsql As String
 strSQL = "Delete From CTDIEM Where IDCTDIEM=" & IDCTDIEM & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoIDDIEM(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "IDDIEM=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from CTDIEM" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoIDDIEM(ByVal IDDIEM As System.Int32 )
 Chuoi_SQL = " Select * from CTDIEM where  IDDIEM = " & IDDIEM & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoIDDIEM(ByVal IDDIEM As System.Int32)
 Dim strsql As String
 strSQL = "Delete From CTDIEM Where IDDIEM=" & IDDIEM & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoDIEM(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "DIEM=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from CTDIEM" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoDIEM(ByVal DIEM As System.Int32 )
 Chuoi_SQL = " Select * from CTDIEM where  DIEM = " & DIEM & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoDIEM(ByVal DIEM As System.Int32)
 Dim strsql As String
 strSQL = "Delete From CTDIEM Where DIEM=" & DIEM & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoLOAIDIEM(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "LOAIDIEM=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from CTDIEM" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoLOAIDIEM(ByVal LOAIDIEM As System.Int32 )
 Chuoi_SQL = " Select * from CTDIEM where  LOAIDIEM = " & LOAIDIEM & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoLOAIDIEM(ByVal LOAIDIEM As System.Int32)
 Dim strsql As String
 strSQL = "Delete From CTDIEM Where LOAIDIEM=" & LOAIDIEM & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoTRANGTHAI(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "TRANGTHAI=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from CTDIEM" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoTRANGTHAI(ByVal TRANGTHAI As System.Int32 )
 Chuoi_SQL = " Select * from CTDIEM where  TRANGTHAI = " & TRANGTHAI & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoTRANGTHAI(ByVal TRANGTHAI As System.Int32)
 Dim strsql As String
 strSQL = "Delete From CTDIEM Where TRANGTHAI=" & TRANGTHAI & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoGHICHU(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "GHICHU='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from CTDIEM" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoGHICHU_like (ByVal GHICHU As System.String )
 Chuoi_SQL = " Select * from CTDIEM where  GHICHU  like '%" & GHICHU & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoGHICHU(ByVal GHICHU As System.String )
 Chuoi_SQL = " Select * from CTDIEM where  GHICHU = '" & GHICHU & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoGHICHU(ByVal GHICHU As System.String)
 Dim strsql As String
 strSQL = "Delete From CTDIEM Where GHICHU='" & GHICHU & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangNhieuTable
 Chuoi_SQL = " Select IDCTDIEM ,IDDIEM ,DIEM ,LOAIDIEM ,TRANGTHAI ,GHICHU  from CTDIEM"
 Doc_bang()
 End sub
Public Sub TaoTable()
Dim strsql As String
strsql = ""
Select Case ketnoi.MsSql
Case Class_KieuDL.Access 
Case Class_KieuDL.Sql, Class_KieuDL.sqlExpress
strsql = ""
Case Class_KieuDL.SqlCe
strsql = ""
Case Class_KieuDL.Oracle
strsql = ""
Case else 
strsql = ""
End Select
Thuc_hien_lenh(strsql)
End Sub
 End Class

